import { Component, Input, OnInit } from '@angular/core';
import { SFSchema } from '@delon/form';
import { ApiService } from '@core/services/api';
import { HttpClient } from '@angular/common/http';
import { NzMessageService, NzModalRef } from 'ng-zorro-antd';

@Component({
  selector: 'warning-detail',
  templateUrl: './warning-detail.component.html',
  styles: []
})
export class WarningDetailComponent implements OnInit {
  @Input()type: 0 | 1;
  @Input()
  set _param(value) {
    if (!value) return;
    this.param = value;
    // this.getWarningDetail(this.param.id);
  };
  param: any;
  showForm = false;
  schema: SFSchema = {
    properties: {
      createTime: {
        type: 'string',
        title: 'createTime',
        readOnly: true
      },
      deviceId: {
        type: 'string',
        title: 'deviceId'
      },
      eventAppraise: {
        type: 'string',
        title: 'eventAppraise'
      },
      eventDesc :{
        type: 'string',
        title: 'eventDesc'
      },
      eventDisposeStatus :{
        type: 'string',
        title: 'eventDisposeStatus'
      },
      eventDisposeTime: {
        type: 'string',
        title: 'eventDisposeTime'
      },
      eventFeedback: {
        type: 'string',
        title: 'eventFeedback'
      },
      eventId: {
        type: 'string',
        title: 'eventId'
      },
      eventImgUrl: {
        type: 'string',
        title: 'eventImgUrl'
      },
      eventLevel: {
        type: 'string',
        title: 'eventLevel'
      },
      eventName: {
        type: 'string',
        title: 'eventName'
      },
      eventProcessingTime: {
        type: 'string',
        title: 'eventProcessingTime'
      },
      eventProduceTime: {
        type: 'string',
        title: 'eventProduceTime'
      },
      eventResponseName: {
        type: 'string',
        title: 'eventResponseName'
      },
      eventResponsePhone: {
        type: 'string',
        title: 'eventResponsePhone'
      },
      eventResponseUnit: {
        type: 'string',
        title: 'eventResponseUnit'
      },
      personId: {
        type: 'string',
        title: 'personId'
      },
      updateTime: {
        type: 'string',
        title: 'updateTime'
      },
      status: {
        type: 'string',
        title: 'status'
      }
      
    },
    required: []
  }
  
  getWarningDetail(id: string): Promise<any>{
    return this.http.request<any>('GET', '/core/event/'+id).toPromise();
  }
  formSubmit(data) {

  }
  constructor(
    private api: ApiService,
    private http: HttpClient,
    private msg: NzMessageService,
    private modalRef: NzModalRef
  ) { }

  async ngOnInit() {
    this.showForm = true;
  }

}
